package customer.zspt.cn.customer.components.servex;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.google.gson.Gson;
import com.lidroid.xutils.BitmapUtils;

import customer.zspt.cn.customer.R;
import customer.zspt.cn.customer.bean.ServexDao;

/**
 * Created by Administrator on 2018/6/17 0017.
 */

public class servex_view extends Activity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.servex_view);
        String servexId = getIntent().getStringExtra("servexId");
        Log.e("servex",servexId);
        toPull(servexId);
    }
    private void toPull(String servexId) {
        Gson gson = new Gson();
        ServexDao.Info info = gson.fromJson(servexId, ServexDao.Info.class);
        initUI(info);
        System.out.println(info.toString());
    }
    private void initUI(ServexDao.Info data) {
        BitmapUtils utils = new BitmapUtils(this);
        ImageView icon = findViewById(R.id.icon);
        TextView name = findViewById(R.id.name);
        TextView about = findViewById(R.id.about);
        utils.display(icon,data.servexAvatar);
        name.setText(data.servexTitle);
        if(!data.servexDescription.equals("")){
            about.setText(data.servexDescription);
        }
        else{
            about.setVisibility(View.GONE);
        }
    }
}
